/**
 * Created by Admin on 2018/1/4.
 */
define(function (require, exports, module) {
    var Pat = require("./pat.js");
    var template = require("template");
    var apiUrl = "",keyName,selfTitle,exportUrl;
    $(function () {
        switch($(".analysis-title").html()){
            case "专利权转出":
                apiUrl = "monanalysis/out";
                keyName = "areaName";
                selfTitle = "今年专利权转出";
                exportUrl = "monanalysisexport/out";
                break;
            case "专利权转入":
                apiUrl = "monanalysis/in";
                keyName = "areaName";
                selfTitle = "今年专利权转入";
                exportUrl = "monanalysisexport/in";
                break;
            case "专利失效":
                apiUrl = "monanalysis/invalid";
                keyName = "reason";
                selfTitle = "未缴年费";
                exportUrl = "monanalysisexport/invalid";
                break;
        }
        Pat.initTable(apiUrl,exportUrl,keyName,$("#searchForm").serialize(),selfTitle);
        $("body").on("click",".down",function(){
            $(this).removeClass("down").addClass("up");
            $("[name=order]").val("asc");
            $("[name=sort]").val($(this).attr("data-sort"));
            Pat.initTable(apiUrl,exportUrl,keyName,$("#searchForm").serialize(),selfTitle);
        }).on("click",".up",function(){
            $(this).removeClass("up").addClass("down");
            $("[name=order]").val("desc");
            $("[name=sort]").val($(this).attr("data-sort"));
            Pat.initTable(apiUrl,exportUrl,keyName,$("#searchForm").serialize(),selfTitle);
        })
    })
})